package com.muyu.system.service.impl;


import com.muyu.common.core.utils.DateUtils;
import com.muyu.system.domain.DanmoShoppingUser;
import com.muyu.system.mapper.DanmoShoppingUserMapper;
import com.muyu.system.service.IDanmoShoppingUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品关注Service业务层处理
 *
 * @author yangle
 * @date 2024-09-29
 */
@Service
public class DanmoShoppingUserServiceImpl implements IDanmoShoppingUserService
{
    @Autowired
    private DanmoShoppingUserMapper danmoShoppingUserMapper;

    /**
     * 查询商品关注
     *
     * @param id 商品关注主键
     * @return 商品关注
     */
    @Override
    public DanmoShoppingUser selectDanmoShoppingUserById(Long id)
    {
        return danmoShoppingUserMapper.selectDanmoShoppingUserById(id);
    }

    /**
     * 查询商品关注列表
     *
     * @param danmoShoppingUser 商品关注
     * @return 商品关注
     */
    @Override
    public List<DanmoShoppingUser> selectDanmoShoppingUserList(DanmoShoppingUser danmoShoppingUser)
    {
        return danmoShoppingUserMapper.selectDanmoShoppingUserList(danmoShoppingUser);
    }

    /**
     * 新增商品关注
     *
     * @param danmoShoppingUser 商品关注
     * @return 结果
     */
    @Override
    public int insertDanmoShoppingUser(DanmoShoppingUser danmoShoppingUser)
    {
        danmoShoppingUser.setCreateTime(DateUtils.getNowDate());
        return danmoShoppingUserMapper.insertDanmoShoppingUser(danmoShoppingUser);
    }

    /**
     * 修改商品关注
     *
     * @param danmoShoppingUser 商品关注
     * @return 结果
     */
    @Override
    public int updateDanmoShoppingUser(DanmoShoppingUser danmoShoppingUser)
    {
        danmoShoppingUser.setUpdateTime(DateUtils.getNowDate());
        return danmoShoppingUserMapper.updateDanmoShoppingUser(danmoShoppingUser);
    }

    /**
     * 批量删除商品关注
     *
     * @param ids 需要删除的商品关注主键
     * @return 结果
     */
    @Override
    public int deleteDanmoShoppingUserByIds(Long[] ids)
    {
        return danmoShoppingUserMapper.deleteDanmoShoppingUserByIds(ids);
    }

    /**
     * 删除商品关注信息
     *
     * @param id 商品关注主键
     * @return 结果
     */
    @Override
    public int deleteDanmoShoppingUserById(Long id)
    {
        return danmoShoppingUserMapper.deleteDanmoShoppingUserById(id);
    }

    @Override
    public DanmoShoppingUser selectUserFlagship(DanmoShoppingUser danmoShoppingUser) {
        return danmoShoppingUserMapper.selectUserFlagship(danmoShoppingUser);
    }

    @Override
    public void addUserFlagship(DanmoShoppingUser danmoShoppingUser) {
        danmoShoppingUser.setCreateTime(DateUtils.getNowDate());
             danmoShoppingUserMapper.addUserFlagship(danmoShoppingUser);
    }

    @Override
    public void deleteUserFlagship(DanmoShoppingUser danmoShoppingUser) {
        danmoShoppingUserMapper.deleteUserFlagship(danmoShoppingUser);
    }
}
